package com.site.dakosoftware.client;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.user.client.ui.AbsolutePanel;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.RootLayoutPanel;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.MenuBar;
import com.google.gwt.user.client.ui.MenuItem;
import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.PushButton;
import com.google.gwt.user.client.ui.Frame;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.user.client.ui.DecoratorPanel;

public class DakoSoftwareMain implements EntryPoint {
	String pathToFTP = "http://dakosoftware.nl/mainSite/Subsites/";

	public void onModuleLoad() {

//		********** Building the Framework ************
		
		RootPanel rootPanel = RootPanel.get();
		rootPanel.setStyleName("gwt-RootPanel");
		rootPanel.setSize("", "");
		RootLayoutPanel rootLayoutPanel = RootLayoutPanel.get();
		rootLayoutPanel.setSize("1200", "800");

		AbsolutePanel absolutePanel = new AbsolutePanel();
		rootLayoutPanel.add(absolutePanel);
		rootLayoutPanel.setWidgetLeftWidth(absolutePanel, 0.0, Unit.PX, 130.0,
				Unit.PX);
		rootLayoutPanel.setWidgetTopHeight(absolutePanel, 0.0, Unit.PX, 800.0,
				Unit.PX);

		Image Logo = new Image("Images/Logo_1.png");
		absolutePanel.add(Logo, 0, 0);
		Logo.setSize("125", "125");

		AbsolutePanel absolutePanel_1 = new AbsolutePanel();
//		absolutePanel_1.setStyleName("gwt-IFrame");
		rootLayoutPanel.add(absolutePanel_1);
		rootLayoutPanel.setWidgetLeftWidth(absolutePanel_1, 130.0, Unit.PX,
				1070.0, Unit.PX);
		rootLayoutPanel.setWidgetTopHeight(absolutePanel_1, 0.0, Unit.PX, 90.0,
				Unit.PX);
		
		Image LogoText = new Image("Images/Logo_2.png");
		absolutePanel_1.add(LogoText, 0, 53);
		LogoText.setSize("160px", "32px");

		
		DecoratorPanel decoratorPanel = new DecoratorPanel();
		rootLayoutPanel.add(decoratorPanel);
		rootLayoutPanel.setWidgetLeftWidth(decoratorPanel, 130.0, Unit.PX,
				1070.0, Unit.PX);
		rootLayoutPanel.setWidgetTopHeight(decoratorPanel, 90.0, Unit.PX, 775.0,
				Unit.PX);
		decoratorPanel.setSize("1070px", "685px");
		
		final Frame frmCenter = new Frame(pathToFTP+"_Home.html");
		decoratorPanel.setWidget(frmCenter);
		frmCenter.setSize("1055px", "670px");
		
		AbsolutePanel absolutePanel_3 = new AbsolutePanel();
		rootLayoutPanel.add(absolutePanel_3);
		rootLayoutPanel.setWidgetLeftWidth(absolutePanel_3, 130.0, Unit.PX,
				1070.0, Unit.PX);
		rootLayoutPanel.setWidgetTopHeight(absolutePanel_3, 775.0, Unit.PX,
				25.0, Unit.PX);
		
		PushButton btnButton1 = new PushButton("DakoSoftware");
		btnButton1.setStyleName("gwt-ButtonTransparent");
		absolutePanel_3.add(btnButton1,20,0);
		btnButton1.setWidth("100");
		btnButton1.addClickHandler(new ClickHandler() {
			public void onClick(ClickEvent event) {
				Window.alert("Hello");}
		});
		PushButton btnButton2 = new PushButton("Print this page");
		btnButton2.setStyleName("gwt-ButtonTransparent");
		absolutePanel_3.add(btnButton2, 126, 0);
		btnButton2.setWidth("100");
		btnButton2.addClickHandler(new ClickHandler() {
			public void onClick(ClickEvent event) {
			Window.print();}
		});
		PushButton btnButton3 = new PushButton("Adres en Bankgegevens?");
		btnButton3.getUpHoveringFace().setText("Hilversum ING Bank");
		btnButton3.setStyleName("gwt-ButtonTransparent");
//		btnButton3.addMouseOverHandler(null);
		btnButton3.setFocus(false);
		absolutePanel_3.add(btnButton3, 494, 0);
		btnButton3.setSize("200px", "15px");

		 final PushButton btnButton4 = new PushButton("Android Support", new ClickHandler() { 
	            @Override 
	            public void onClick(final ClickEvent event) { 
	                Window.open("mailto:androidsupport@dakosoftware.com?subject=Question%20about%20Android", "", "");} 
	        });
		 btnButton4.setStyleName("gwt-ButtonTransparent");
		 absolutePanel_3.add(btnButton4, 232, 0);
		 btnButton4.setWidth("100");
		
		 final PushButton btnButton5 = new PushButton("DakoSoftware Support", new ClickHandler() { 
	            @Override 
	            public void onClick(final ClickEvent event) { 
	                Window.open("mailto:info@dakosoftware.com?subject=Question%20about%20Spreadsheets%20for%20Structural%20Engineering", "", "");} 
	        });
		 btnButton5.setStyleName("gwt-ButtonTransparent");
		 absolutePanel_3.add(btnButton5, 338, 0);
		 btnButton5.setWidth("150");
		 
//		********** End of Building the Framework ************
		 
		 
//		********** Building the Menu ************
				
		MenuBar menuBar = new MenuBar(false);
		menuBar.setFocusOnHoverEnabled(false);
		menuBar.setAutoOpen(true);
		absolutePanel_1.add(menuBar, 220, 66);
		
		MenuItem mntmHome = new MenuItem("Home", false, new Command()
		{public void execute (){frmCenter.setUrl(pathToFTP+"_Home.html"); }});
		menuBar.addItem(mntmHome);
		mntmHome.setWidth("100px");
		
		MenuBar menuBar_1 = new MenuBar(true);
		menuBar_1.setAutoOpen(true);
		MenuItem mntmProducts = new MenuItem("Products", false, menuBar_1);		
		MenuItem mntmToolsEurocode = new MenuItem("Tools Eurocode", false, new Command()
		{public void execute (){frmCenter.setUrl(pathToFTP+"_ToolsEurocode.html"); }});
		mntmToolsEurocode.setStyleName("gwt-SubMenuItem");
		menuBar_1.addItem(mntmToolsEurocode);		
		MenuItem mntmToolsTgb = new MenuItem("Tools TGB 1990", false, new Command()
		{public void execute (){frmCenter.setUrl(pathToFTP+"_ToolsTGB1990.html"); }});
		mntmToolsTgb.setStyleName("gwt-SubMenuItem");
		menuBar_1.addItem(mntmToolsTgb);		
		MenuItem mntmAndroid = new MenuItem("Tools Android", false, new Command()
		{public void execute (){frmCenter.setUrl(pathToFTP+"_ToolsAndroid.html"); }});
		mntmAndroid.setStyleName("gwt-SubMenuItem");
		menuBar_1.addItem(mntmAndroid);		
		MenuItem mntmRates = new MenuItem("Rates", false, new Command()
		{public void execute (){frmCenter.setUrl(pathToFTP+"_Rates.html"); }});
		mntmRates.setStyleName("gwt-SubMenuItem");
		menuBar_1.addItem(mntmRates);		
		MenuItem mntmWebtools = new MenuItem("Webtools", false, new Command()
		{public void execute (){frmCenter.setUrl(pathToFTP+"_Webtools.html"); }});
		mntmWebtools.setEnabled(false);
		mntmWebtools.setStyleName("gwt-SubMenuItem-inactive");
		menuBar_1.addItem(mntmWebtools);		
		menuBar.addItem(mntmProducts);
		mntmProducts.setWidth("100px");
		
		MenuBar menuBar_2 = new MenuBar(true);		
		MenuItem mntmValidations = new MenuItem("Validations", false, menuBar_2);		
		MenuItem mntmEurocode = new MenuItem("Eurocode", false, new Command()
		{public void execute (){frmCenter.setUrl(pathToFTP+"_ValEurocode.html"); }});
		mntmEurocode.setStyleName("gwt-SubMenuItem-inactive");
		mntmEurocode.setEnabled(false);
		menuBar_2.addItem(mntmEurocode);		
		MenuItem mntmTgbonly = new MenuItem("TGB 1990 (only in Dutch)", false, new Command()
		{public void execute (){frmCenter.setUrl(pathToFTP+"_ValTGB1990.html"); }});
		mntmTgbonly.setStyleName("gwt-SubMenuItem");
		menuBar_2.addItem(mntmTgbonly);
		menuBar.addItem(mntmValidations);
		mntmValidations.setWidth("100px");
		
		MenuBar menuBar_3 = new MenuBar(true);		
		MenuItem mntmCustomers = new MenuItem("Customers", false, menuBar_3);
		menuBar.addItem(mntmCustomers);
		mntmCustomers.setWidth("100px");
		
		MenuBar menuBar_4 = new MenuBar(true);		
		MenuItem mntmContact = new MenuItem("Contact", false, menuBar_4);		
		MenuItem mntmSpreadsheetsForStructural = new MenuItem("Spreadsheets for Structural Engineering", false, new Command()
		{public void execute (){frmCenter.setUrl(pathToFTP+"_ContactSfSE.html"); }});
		mntmSpreadsheetsForStructural.setStyleName("gwt-SubMenuItem");
		menuBar_4.addItem(mntmSpreadsheetsForStructural);		
		MenuItem mntmAndroid_1 = new MenuItem("Android", false, new Command()
		{public void execute (){frmCenter.setUrl(pathToFTP+"_ContactAndroid.html"); }});
		mntmAndroid_1.setStyleName("gwt-SubMenuItem");
		menuBar_4.addItem(mntmAndroid_1);
		menuBar.addItem(mntmContact);
		mntmContact.setWidth("100px");
			
		MenuItem mntmAbout = new MenuItem("About", false, new Command()
		{public void execute (){frmCenter.setUrl(pathToFTP+"_About.html"); }});
		menuBar.addItem(mntmAbout);
		mntmAbout.setWidth("100px");

//		********** End of Building the Menu ************
		
		
		PushButton pshbtnUk = new PushButton("UK");
		absolutePanel_1.add(pshbtnUk, 992, 10);		
		PushButton pshbtnDe = new PushButton("DE");
		pshbtnDe.setEnabled(false);
		absolutePanel_1.add(pshbtnDe, 1015, 10);		
		PushButton pshbtnNl = new PushButton("NL");
		pshbtnNl.setEnabled(false);
		absolutePanel_1.add(pshbtnNl, 1038, 10);
		

	}
}
